package org.simpleframework.util;

import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;

/**
 * @ClassName ValidationUtil
 * @Description
 * @Author 47980
 * @Date 2020/6/14 10:23
 * @Version V_1.0
 **/
public class ValidationUtil {

    /**
     * Collection 为空判断
     *
     * @param obj
     * @return
     */
    public static boolean isEmpty(Collection<?> obj) {
        return (obj == null || obj.isEmpty());
    }

    /**
     * String 为空判断
     *
     * @param obj
     * @return
     */
    public static boolean isEmpty(String obj) {
        return (obj == null || "".equals(obj));
    }

    /**
     * Array 为空判断
     *
     * @param obj
     * @return
     */
    public static boolean isEmpty(Object[] obj) {
        return (obj == null || obj.length == 0);
    }

    /**
     * Map 为空判断
     *
     * @param obj
     * @return
     */
    public static boolean isEmpty(Map<?, ?> obj) {
        return obj == null || obj.isEmpty();
    }
}
